<?php

class Persion {
    public $name = 'lisi';
    protected $age = 22;
    private $money = 1000;
    public function __construct($name='lisi')
    {
        $this->name=$name;
    }
    public function test(){
        echo 'Persion->test';
    }
    public function t2(){
        //echo '参数个数',func_num_args();
        //print_r(func_get_args());
        $args = func_num_args();
        $args_arr = func_get_args();
        switch($args){
            case 0:
                echo '没有参数'.'<br>';
                break;
            case 1:
                    echo '有1参数'.'<br>';
                    break;
            case 2:
                        echo '有2参数'.'<br>';
                        break;
            default:
                            echo '未定义的参数调用方式'.'<br>';
                            break;
        }
    }

    
}

class Stu extends Persion{
    public $age;
    public function __construct($name='lisi',$age)
    {
        $this->name=$name;
        $this->age = $age;
    }
    public function test($a=1,$b=2){
        echo 'Stu->test';
    }
}

$p1 = new Persion();
$p1->t2();

$lisi = new Stu('wangwu',22);
echo $lisi->name;
echo $lisi->age;
echo $lisi->test();